package cn.le.helloWorld;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 项目名  spring-boot
 * Created by lansp
 * Created at 2018/5/31
 * 描述: 消息发送者
 */
@Component
public class Sender {

	@Autowired
	private AmqpTemplate rabbitMq;

	public void send(){
		String context = "hello " + new Date();
		System.out.println("Sender : " + context);
		rabbitMq.convertAndSend("hello",context);
	}

}
